Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS: Add bright background to images when using dark theme #309

Merged
merged 1 commit into from
Nov 18, 2022

Conversation

matevz
Copy link
Member

@matevz matevz commented Nov 17, 2022

A temporary hack to mitigate #308. Adds white background to images when switching to dark theme.

before after
image image
image image

@matevz matevz requested a review from lukaw3d November 17, 2022 11:43
@netlify
Copy link

netlify bot commented Nov 17, 2022

Deploy Preview for trusting-archimedes-14c863 ready!

Name Link
🔨 Latest commit f788023
🔍 Latest deploy log https://app.netlify.com/sites/trusting-archimedes-14c863/deploys/63761e5253b1f10008beb365
😎 Deploy Preview https://deploy-preview-309--trusting-archimedes-14c863.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -89,3 +89,8 @@ html[data-theme='dark'] .docusaurus-highlight-code-line {
.theme-doc-sidebar-menu {
font-size: 14px;
}

/* Hack to make .svg and .png diagrams readable in dark theme */
html[data-theme='dark'] main img {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we'll be adding some transparent themed images: img:not([class^="themedImage"])

(not the most stable element selector but, https://docusaurus.io/docs/markdown-features/assets#themed-images
compiles un-themed images as <img class="img_vXGZ">
and themed images as <img class="themedImage_qLAv themedImage--dark_ONYO"> )

Copy link
Member

@lukaw3d lukaw3d Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh. and :not([src$='#gh-dark-mode-only'])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really - I imagined when #308 is done properly, then each image must either be universal (good to read both on light and dark background) or themed (one image for light, other for dark theme). Your hack would always set the background for universal images when on the dark background even though they should be readable fine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep yep

@matevz matevz merged commit 60b1d91 into main Nov 18, 2022
@matevz matevz deleted the matevz/docs/dark-theme-add-image-background branch November 18, 2022 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants